package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.cucc.service.attr.handler.NetworkingModeHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

/**
 * @Description: A端汇聚电路业务号码/Z端汇聚电路业务号码应该只在组网方式选择“汇聚”的时候展示
 * @ClassName: NetworkingModeHandler
 * @Author: zyy
 * @Date: 2021/3/7 11:14
 * @Version: 1.0
 */
@Service
@AttrHandler(NetworkingModeHandler.class)
public class NetworkingModeLinkHandler extends AbstractAttrLinkageHandler<AttrData> {


    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {
        //获取A端汇聚电路业务号码
        KiteAttr attrACircuitNbr = kiteInst.getAttr("2_0000138");
        //获取Z端汇聚电路业务号码
        KiteAttr attrBCircuitNbr = kiteInst.getAttr("2_0000139");

        //判断是否为【A端组网方式】
        if("2_0000023".equals(kiteAttr.getFieldName())){
            //判断是否选择“汇聚”
            if("1_0000175".equals(kiteAttr.getValue())){
                //设置为展示;
                attrACircuitNbr.setShowType("D");
            }
            else {
                //设置为隐藏;
                attrACircuitNbr.setShowType("E");
            }
        }
        //【Z端组网方式】
        else if ("2_0000024".equals(kiteAttr.getFieldName())){
            //判断是否选择“汇聚”
            if("1_0000175".equals(kiteAttr.getValue())){
                //设置为展示;
                attrBCircuitNbr.setShowType("D");
            }else{
                //设置为隐藏;
                attrBCircuitNbr.setShowType("E");
            }
        }
    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {

    }
}
